// subpkg_user/pages/profile/index.js
const app = getApp()
Page({
    /**
     * 页面的初始数据
     */
    data: {
      nickname:wx.getStorageSync('nickname'),
      avatarUrl:wx.getStorageSync('avatarUrl')// 定义变量记录用户头像
    },
    getNickName(ev){
      // console.log('失去了');
      // console.log(ev.detail.value);
      wx.setStorageSync('nickname',ev.detail.value)
      app.nickname= ev.detail.value
    },
    getAvatar(ev){
      // console.log(ev);
      // console.log(ev.detail.avatarUrl);
      this.setData({
        avatarUrl:ev.detail.avatarUrl
      })
      wx.setStorageSync('avatarUrl', ev.detail.avatarUrl)
      app.avatarUrl= ev.detail.avatarUrl
    },
    onShow(){
      this.setData({
        nickname:wx.getStorageSync('nickname'),
        avatarUrl:app.avatarUrl
      })
    }
})